
# 找到好朋友
h1 = {"game", "TV", "music"}
h2 = {"sing", "shopping", "TV"}
h3 = {'game', 'music'}

lst = [{"name": '路人甲',"hobby": h1},
       {"name": '路人乙', "hobby": h2},
       {"name": '路人丙', "hobby": h3
    }]

for i in range(len(lst)):
    for j in range(i+1, len(lst)):
        h = lst[j]['hobby'] & lst[i]['hobby']
        if len(h)>0:
            print(f"{lst[i]['name']}与{lst[j]['name']}会成为好朋友")

